# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=airpwn
pkgver=1.4
pkgrel=3
pkgdesc='A tool for generic packet injection on an 802.11 network.'
arch=('x86_64' 'aarch64')
url='http://airpwn.sourceforge.net/'
license=('GPL')
depends=('pcre' 'libpcap' 'openssl' 'lorcon-old' 'wireless_tools' 'libnet'
         'python2')
groups=('blackarch' 'blackarch-wireless')
source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tgz")
sha512sums=('c849740848289005eb2a72b09bbfade6bf078a3ff93d39300f6a65d328c527bbafbb2a325f2813064612f91a2da20a2daacb8508497e8410ad0befc4e28331e5')

build() {
  cd "$pkgname-$pkgver"

  unset LDFLAGS

  ./configure --prefix=/usr --mandir=/usr/share/man

  sed -i 's/python2.4/python2/g' conf.h
  sed -i 's|python2/Python\.h|python2.7/Python.h|' conf.h
  sed -i 's|LDFLAGS = |LDFLAGS = -lssl -lcrypto -lorcon -lpthread -lpcre -lpcap -lnet -lpython2.7|g' Makefile

  make
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp -aR * "$pkgdir/usr/share/$pkgname/"

  ln -s /usr/share/airpwn/airpwn "$pkgdir/usr/bin/"
  ln -s /usr/share/airpwn/wep_keygen "$pkgdir/usr/bin/"
}

